package top.withwings.bonus.bonus.pojo;

import top.withwings.bonus.bonus.pojo.bonus.rule.OnSaleBonusRule;

import java.util.Date;
import java.util.List;

public class OnSaleForm {

    private int id;

    private OnSaleBonusRule rule;

    private Good good;

    private Date start;

    private Date end;

    @Override
    public String toString() {
        return "OnSaleForm{" +
                "id=" + id +
                ", rule=" + rule +
                ", good=" + good +
                ", start=" + start +
                ", end=" + end +
                ", batchNos=" + batchNos +
                '}';
    }

    private List<String> batchNos;

    public Good getGood() {
        return good;
    }

    public void setGood(Good good) {
        this.good = good;
    }

    public Date getStart() {
        return start;
    }

    public void setStart(Date start) {
        this.start = start;
    }

    public Date getEnd() {
        return end;
    }

    public void setEnd(Date end) {
        this.end = end;
    }

    public List<String> getBatchNos() {
        return batchNos;
    }

    public void setBatchNos(List<String> batchNos) {
        this.batchNos = batchNos;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public OnSaleBonusRule getRule() {
        return rule;
    }

    public void setRule(OnSaleBonusRule rule) {
        this.rule = rule;
    }

    public boolean isEffectiveNow(){
        Date now = new Date();
        return now.after(start) && now.before(end);
    }


}